import React from 'react'
import store from '../../store/store'
import {movieActions} from '../../store/actions/movieActions'
import { useDispatch, useSelector} from 'react-redux'


export default function Movie (){
    const dispatch = useDispatch()
    const count = useSelector((state)=>state.count.count)
    const movieList =useSelector((state)=>state.movie.movieList)
    const getMovieListHandle =()=>{
           dispatch(movieActions())
    }
    
    return( 
        <div>
            <h1>我是Movie组件,我用的是count组件中的{count}</h1>
            <button onClick={getMovieListHandle}>获取电影信息</button>
            <ul>
                {
                    movieList.map((item)=>{
                            return <li key={item.tvId}>{item.albumName}</li>
                    })
                }
            </ul>
        </div>
    )
}